{include="header"}

<script type="text/javascript">
   function delete_impuesto(cod)
   {
      if( confirm("¿Realmente desea eliminar el impuesto "+cod+"?") )
         window.location.href = '{$fsc->url()}&delete='+cod;
   }
</script>

<div class="table-responsive">
   <table class="table table-hover">
      <thead>
         <tr>
            <th class="text-left">Código</th>
            <th class="text-left">Descripción</th>
            <th class="text-right">% IVA</th>
            <th class="text-right">% Recargo</th>
            <th class="text-right" width="140">Acciones</th>
         </tr>
      </thead>
      {loop="$fsc->impuesto->all()"}
      <form class="form" role="form" action ="{$fsc->url()}" method="post">
         <input type="hidden" name="codimpuesto" value="{$value->codimpuesto}"/>
         <tr>
            <td>
               <div class="form-control">{$value->codimpuesto}</div>
            </td>
            <td>
               <input class="form-control" type="text" name="descripcion" value="{$value->descripcion}" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control text-right" type="number" step="any" name="iva" value="{$value->iva}" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control text-right" type="number" step="any" name="recargo" value="{$value->recargo}" autocomplete="off"/>
            </td>
            <td class="text-right">
               <div class="btn-group">
                  <button class="btn btn-sm btn-danger" type="button" title="Eliminar" onclick="delete_impuesto('{$value->codimpuesto}')">
                     <span class="glyphicon glyphicon-trash"></span>
                  </button>
                  <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();" title="Guardar">
                     <span class="glyphicon glyphicon-floppy-disk"></span>
                  </button>
               </div>
            </td>
         </tr>
      </form>
      {/loop}
      <form class="form" name="f_nuevo_impuesto" action="{$fsc->url()}" method="post">
         <tr class="bg-info">
            <td>
               <input class="form-control" type="text" name="codimpuesto" placeholder="Nuevo código..." autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="descripcion" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control text-right" type="number" step="any" name="iva" value="0" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control text-right" type="number" step="any" name="recargo" value="0" autocomplete="off"/>
            </td>
            <td class="text-right">
               <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();" title="Guardar">
                  <span class="glyphicon glyphicon-floppy-disk"></span>
               </button>
            </td>
         </tr>
      </form>
   </table>
</div>

{include="footer"}